package me.moscrop.RootCommand.commands;

import java.util.HashMap;
import java.util.Map;

import me.moscrop.RootCommand.utilities.Chat;

import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class God {
	
	public static Map<String, Boolean> GodPlayers = new HashMap<String, Boolean>();

	public static boolean toggle(CommandSender sender, String[] args) {
		
		Player player = (Player) sender;
		
		if(isGod(player)) {
			setGod(player, true);
			Chat.messageAll(player, " is now in God Mode");
			return true;
		} else {
			setGod(player, false);
			Chat.messageAll(player, " is no longer in God Mode");
			return true;
		}
				
		
	}

	public static boolean isGod(Player player) {
		if(GodPlayers.containsKey(player.getName())) {
			return true;
		} else {
			return false;
		}
	}

	private static void setGod(Player player, boolean makeGod) {		
		GodPlayers.put(player.getName(), makeGod);	
		
	}
	
	
	
}
